/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "paquete_familia", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "PaqueteFamilia.findAll", query = "SELECT p FROM PaqueteFamilia p"),
    @NamedQuery(name = "PaqueteFamilia.findByIdPaqueteFamilia", query = "SELECT p FROM PaqueteFamilia p WHERE p.idPaqueteFamilia = :idPaqueteFamilia"),
    @NamedQuery(name = "PaqueteFamilia.findByPaqFecha", query = "SELECT p FROM PaqueteFamilia p WHERE p.paqFecha = :paqFecha")})
public class FamilyPackage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_paquete_familia")
    private Integer id;
    @Column(name = "paq_fecha")
    @Temporal(TemporalType.DATE)
    private Date date;
    @JoinColumn(name = "npa_id_nombre_paquete", referencedColumnName = "id_nombre_paquete")
    @ManyToOne(optional = false)
    private PackageName packageName;
    @JoinColumn(name = "vis_id_visita_domiciliaria", referencedColumnName = "id_visita_domiciliaria")
    @ManyToOne(optional = false)
    private HomeVisit homeVisit;

    public FamilyPackage() {
    }

    public FamilyPackage(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public PackageName getPackageName() {
        return packageName;
    }

    public void setPackageName(PackageName packageName) {
        this.packageName = packageName;
    }

    public HomeVisit getHomeVisit() {
        return homeVisit;
    }

    public void setHomeVisit(HomeVisit homeVisit) {
        this.homeVisit = homeVisit;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FamilyPackage)) {
            return false;
        }
        FamilyPackage other = (FamilyPackage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.FamilyPackage[ id=" + id + " ]";
    }
    
}
